<?php
class retrieve_filter_admin extends retrieve_base{

	private $module_display_options 	= array();
	/**
	* function produces abstract structure of modules db structure
	*
    * used to generate the table structure required abstract function that passes an abstract
	* representation of the desired table structure to the proper database module which will
	* interpet the abstract and convert it into a valid SQL Create table structure.
	*
	* @return Array list of abstract table definitions for this module
	*/
	function create_table(){
		$tables = array();
		/**
		* Table structure for table 'filter_list'
		*/
		$fields = array(
			array("filter_identifier"		,"unsigned integer"			,"NOT NULL"	,"default '0'","auto_increment"),
			array("filter_client"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("filter_label"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("filter_creation_date"	,"datetime"					,"NOT NULL"	,"default '0000-00-00 00:00:00'"),
			array("filter_status"			,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("filter_module"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("filter_owner"			,"unsigned integer"			,"NOT NULL"	,"default '0'"),
			array("filter_cache"			,"text"						,"NOT NULL" ,"default ''")
		);
		$primary ="filter_identifier";
		$tables[count($tables)] = array("filter_list", $fields, $primary);
		/**
		* Table structure for table 'filter_definition'
		*/
		$fields = array(
			array("fdef_identifier"		,"unsigned integer"			,"NOT NULL"	,"default '0'","auto_increment"),
			array("fdef_client"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("fdef_filter"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("fdef_field"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("fdef_condition"		,"unsigned integer"			,"NOT NULL"	,"default '0'"), // 0= or , 1= and
			array("fdef_value"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("fdef_join"			,"varchar(255)"				,"NOT NULL"	,"default ''")
		);
		$primary ="fdef_identifier";
		$tables[count($tables)] = array("filter_definition", $fields, $primary);
		/**
		* Table structure for table 'filter_definition'
		*/
		$fields = array(
			array("ford_identifier"		,"unsigned integer"			,"NOT NULL"	,"default '0'","auto_increment"),
			array("ford_client"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("ford_filter"			,"unsigned integer"			,"NOT NULL"	,"default '0'","key"),
			array("ford_field"			,"varchar(255)"				,"NOT NULL"	,"default ''"),
			array("ford_direction"		,"unsigned small integer"	,"NOT NULL"	,"default '0'") // 0= Ascending,  1 = descending 
		);
		$primary ="ford_identifier";
		$tables[count($tables)] = array("filter_order", $fields, $primary);
		return $tables;
	}
	/**
	* call the initialisation function only when this module is created
	*/
	function create_client_details($parameters){
	}
		

}
?>